#include <bits/stdc++.h>
using namespace std;
#define int long long

int n, x, A, B, val[300005], tot;
vector<pair<int, int>> edges[300005];

void dfs(int i, int fm, bool l) {
	if (l) val[++tot] = i;
	for (auto j : edges[i]) {
		if (j.first == fm) continue;
		dfs(j.first, i, l);
	}
}

int alice(int, int);
int bob(int, int, bool);


int walk_alice(int st, int f, int rem) {
	if (rem == 0) {
		return bob(st, f, 0);
	}
	int ans = 0;
	for (auto j : edges[st]) {
		if (!(f & (1 << (j.second - 1)))) {
			ans = max(ans, walk_alice(j.first, f | (1 << (j.second - 1)), rem - 1));
		}
	}
	return ans;
}

int walk_bob(int st, int f, int rem, bool fin, int frm) {
	if (rem == 0) {
		if (fin) return st;
		return alice(st, f);
	}
	int ans = 1ll << 60;
	if (fin) ans = min(ans, st);
	else ans = min(ans, alice(st, f));
	for (auto j : edges[st]) {
		if (j.first != frm) {
			ans = min(ans, walk_bob(j.first, f | (1 << (j.second - 1)), rem - 1, fin, st));
		}
	}
	return ans;
}

int bob(int st, int f, bool fin) {
	if (fin) {
		return walk_bob(st, f, B, 1, 0);
	} else {
		return walk_bob(st, f, B, 0, 0);
	}
}

int alice(int st, int f) {
	int t = walk_alice(st, f, A);
	if (t == (0)) return bob(st, f, 1);
	else return t;
}


signed main() {
	freopen("nim.in", "r", stdin); freopen("nim.out", "w", stdout);
	cin >> n >> x >>A >> B;
	for (int i = 1; i < n; ++i) {
		int x, y;
		cin >> x >> y;
		edges[x].push_back({y, i});
		edges[y].push_back({x, i});
	}
	if (A <= B && 0) {
		cout << "1\n";
	} else if (n <= 6) {
		cout << alice(x, 0);
	} else {
		dfs(x, -1, 1);
		int ma = 1ll << 60;
		for (int p = A; p <= n; p += A) {
			for (int i = max(1ll, p - 2 * B); i <= min(n, p - 1 + B); ++i) {
				ma = min(ma, val[i]);
			}
		}
		cout << ma << "\n";
	}
	return 0;
}
/*

A=4
B=2
x -> x -> x -> x -> x -> x -> x -> x -> x -> 1 -> x -> x
1    2    3    4
 */
